package com.baidu.www1;
class Base{
    public int a=1;
    public int b=2;
    public void test1(){
        System.out.println("父类test1");
    }
}
class Derived extends Base{
    public int a=100;
    public int c=3;

public void test1(){
    System.out.println("子类test1");
}
    public void test2(){
       this.test1();
       super.test1();
    }
    public void test(){
        System.out.println(super.a);
        System.out.println(this.a);//this优先访问子类的a
        System.out.println(this.b);
        System.out.println(this.c);
        //如果子类有，优先访问子类，如果子类没有，就会访问父类
    }
}
public class Text2 {

    public static void main(String[] args) {
        Derived derived=new Derived();
        //derived.test();
        derived.test2();
    }
}
